using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace NoteManger
{
	public class FrmSendMsg : Form
	{
		private IContainer components = null;
		private GroupBox groupBox1;
		private Button btnSend;
		private ComboBox cbbReceiverName;
		private Label label5;
		private TextBox tboxComment;
		private Label label4;
		private ComboBox cbbReceiverID;
		private Label label1;
		private DateTimePicker dtpNoteDate;
		private Button btnclose;
		private NoteRemote _NoteRemoteObject = null;
		private TLoginInfo _LoginInfo = new TLoginInfo();
		private string _ReceiverName = "";
		private string _NoteDate = "";
		public NoteRemote NoteRemoteObject
		{
			set
			{
				this._NoteRemoteObject = value;
				if (this._NoteRemoteObject != null)
				{
					try
					{
						if (!this._NoteRemoteObject.ConnectionTest())
						{
							MessageBox.Show("远程连接已断开，请重新连接后再试！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
							return;
						}
					}
					catch (Exception ex)
					{
						MessageBox.Show(ex.Message + "远程连接已断开，请重新连接后再试！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
						return;
					}
					string[,] array = new string[0, 0];
					string text = "";
					bool flag = false;
					try
					{
						flag = this._NoteRemoteObject.GetNeedAuditUserList("", "", "0", ref array, ref text);
					}
					catch (Exception ex)
					{
						MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					}
					if (flag)
					{
						int num = array.GetUpperBound(0) - array.GetLowerBound(0) + 1;
						for (int i = 0; i < num; i++)
						{
							this.cbbReceiverID.Items.Add(array[i, 0]);
							this.cbbReceiverName.Items.Add(array[i, 1]);
						}
					}
					else
					{
						MessageBox.Show(text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					}
				}
			}
		}
		public TLoginInfo LoginInfo
		{
			set
			{
				this._LoginInfo = value;
			}
		}
		public string ReceiverName
		{
			get
			{
				return this._ReceiverName;
			}
			set
			{
				this._ReceiverName = value;
				this.cbbReceiverID.SelectedIndex = this.cbbReceiverName.Items.IndexOf(this._ReceiverName);
				this.cbbReceiverName.SelectedIndex = this.cbbReceiverID.SelectedIndex;
			}
		}
		public string NoteDate
		{
			get
			{
				return this._NoteDate;
			}
			set
			{
				this._NoteDate = value;
				DateTime value2 = default(DateTime);
				DateTime.TryParse(this._NoteDate, out value2);
				this.dtpNoteDate.Value = value2;
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.groupBox1 = new GroupBox();
			this.dtpNoteDate = new DateTimePicker();
			this.label1 = new Label();
			this.btnSend = new Button();
			this.cbbReceiverName = new ComboBox();
			this.label5 = new Label();
			this.tboxComment = new TextBox();
			this.label4 = new Label();
			this.cbbReceiverID = new ComboBox();
			this.btnclose = new Button();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.groupBox1.Controls.Add(this.btnclose);
			this.groupBox1.Controls.Add(this.dtpNoteDate);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.btnSend);
			this.groupBox1.Controls.Add(this.cbbReceiverName);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.tboxComment);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.cbbReceiverID);
			this.groupBox1.Location = new System.Drawing.Point(12, 5);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(400, 206);
			this.groupBox1.TabIndex = 45;
			this.groupBox1.TabStop = false;
			this.dtpNoteDate.Location = new System.Drawing.Point(17, 91);
			this.dtpNoteDate.Name = "dtpNoteDate";
			this.dtpNoteDate.Size = new System.Drawing.Size(363, 21);
			this.dtpNoteDate.TabIndex = 1;
			this.label1.AutoSize = true;
			this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaption;
			this.label1.Location = new System.Drawing.Point(15, 71);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(53, 12);
			this.label1.TabIndex = 52;
			this.label1.Text = "日志日期";
			this.btnSend.Location = new System.Drawing.Point(221, 175);
			this.btnSend.Name = "btnSend";
			this.btnSend.Size = new System.Drawing.Size(75, 23);
			this.btnSend.TabIndex = 3;
			this.btnSend.Text = "发送(&S)";
			this.btnSend.UseVisualStyleBackColor = true;
			this.btnSend.Click += new EventHandler(this.btnSend_Click);
			this.cbbReceiverName.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbReceiverName.Font = new System.Drawing.Font("宋体", 10.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
			this.cbbReceiverName.FormattingEnabled = true;
			this.cbbReceiverName.Location = new System.Drawing.Point(19, 37);
			this.cbbReceiverName.Name = "cbbReceiverName";
			this.cbbReceiverName.Size = new System.Drawing.Size(361, 22);
			this.cbbReceiverName.TabIndex = 0;
			this.label5.AutoSize = true;
			this.label5.ForeColor = System.Drawing.SystemColors.ActiveCaption;
			this.label5.Location = new System.Drawing.Point(17, 17);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(89, 12);
			this.label5.TabIndex = 47;
			this.label5.Text = "反馈信息接受人";
			this.tboxComment.Font = new System.Drawing.Font("宋体", 10.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
			this.tboxComment.Location = new System.Drawing.Point(17, 146);
			this.tboxComment.Name = "tboxComment";
			this.tboxComment.Size = new System.Drawing.Size(361, 23);
			this.tboxComment.TabIndex = 2;
			this.label4.AutoSize = true;
			this.label4.ForeColor = System.Drawing.SystemColors.ActiveCaption;
			this.label4.Location = new System.Drawing.Point(16, 127);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(125, 12);
			this.label4.TabIndex = 45;
			this.label4.Text = "异常审核反馈信息说明";
			this.cbbReceiverID.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.cbbReceiverID.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbReceiverID.FormattingEnabled = true;
			this.cbbReceiverID.Location = new System.Drawing.Point(194, 39);
			this.cbbReceiverID.Name = "cbbReceiverID";
			this.cbbReceiverID.Size = new System.Drawing.Size(20, 20);
			this.cbbReceiverID.TabIndex = 51;
			this.btnclose.Location = new System.Drawing.Point(305, 175);
			this.btnclose.Name = "btnclose";
			this.btnclose.Size = new System.Drawing.Size(75, 23);
			this.btnclose.TabIndex = 53;
			this.btnclose.Text = "关闭(&C)";
			this.btnclose.UseVisualStyleBackColor = true;
			this.btnclose.Click += new EventHandler(this.btnclose_Click);
			base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(421, 220);
			base.Controls.Add(this.groupBox1);
			base.FormBorderStyle = FormBorderStyle.FixedSingle;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "FrmSendMsg";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "发送异常审核反馈信息";
			base.Load += new EventHandler(this.FrmSendMsg_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
		}
		public FrmSendMsg()
		{
			this.InitializeComponent();
		}
		private void FrmSendMsg_Load(object sender, EventArgs e)
		{
		}
		private void btnSend_Click(object sender, EventArgs e)
		{
			int selectedIndex = this.cbbReceiverName.SelectedIndex;
			if (selectedIndex == -1)
			{
				this.cbbReceiverName.Focus();
				MessageBox.Show("反馈信息接受者不能为空！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
			else
			{
				if (this.tboxComment.Text.Trim() == "")
				{
					this.tboxComment.Focus();
					MessageBox.Show("反馈信息内容不能为空！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				else
				{
					try
					{
						if (!this._NoteRemoteObject.ConnectionTest())
						{
							MessageBox.Show("远程连接已断开，请重新连接后再试！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
							return;
						}
					}
					catch (Exception ex)
					{
						MessageBox.Show(ex.Message + "远程连接已断开，请重新连接后再试！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
						return;
					}
					string aNoteDate = this.dtpNoteDate.Value.ToString("yyyy-MM-dd");
					string text = "";
					int selectedIndex2 = this.cbbReceiverName.SelectedIndex;
					if (!this._NoteRemoteObject.CreateAuditFeedBackMessage(this.cbbReceiverID.Items[selectedIndex].ToString(), this._LoginInfo.LoginID, aNoteDate, this.tboxComment.Text.Trim(), this._LoginInfo.LoginID, ref text))
					{
						MessageBox.Show(text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					}
					else
					{
						this.tboxComment.Text = "";
						this.cbbReceiverName.SelectedIndex = -1;
						MessageBox.Show("反馈信息发送成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
					}
				}
			}
		}
		private void btnclose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
	}
}
